import service from '@/utils/request'

export const createIteration = (data) => {
  return service({
    url: 'iteration/createIteration',
    method: 'post',
    data
  })
}

export const deleteIteration = (data) => {
  return service({
    url: 'iteration/deleteIteration',
    method: 'delete',
    data
  })
}

export const updateIteration = (data) => {
  return service({
    url: 'iteration/updateIteration',
    method: 'put',
    data
  })
}

export const getIterationList = (params) => {
  return service({
    url: 'iteration/getIterationList',
    method: 'get',
    params
  })
}

export const getUserListWithoutPage = (params) => {
  return service({
    url: 'user/getUserListWithoutPage',
    method: 'get',
    params
  })
}

export const createVersionPlan = (data) => {
  return service({
    url: 'iteration/createVersionPlan',
    method: 'post',
    data
  })
}

export const findIteration = (params) => {
  return service({
    url: 'iteration/findIteration',
    method: 'get',
    params
  })
}

export const getFlowList = (params) => {
  return service({
    url: 'iteration/getFlowList',
    method: 'get',
    params
  })
}

export const createFlow = (data) => {
  return service({
    url: 'iteration/createFlow',
    method: 'post',
    data
  })
}

// new

export const getDeployments = (params) => {
  return service({
    url: 'k8s/getDeployments',
    method: 'get',
    params
  })
}

export const getContainers = (params) => {
  return service({
    url: 'k8s/getContainers',
    method: 'get',
    params
  })
}

export const getSvc = (params) => {
  return service({
    url: 'k8s/getSvc',
    method: 'get',
    params
  })
}

export const getBranchs = (params) => {
  return service({
    url: 'app/getBranchs',
    method: 'get',
    params
  })
}

export const getReleaseList = (params) => {
  return service({
    url: 'release/getReleaseList',
    method: 'get',
    params
  })
}

export const batchCreateRelease = (data) => {
  return service({
    url: 'release/batchCreateRelease',
    method: 'post',
    data
  })
}

export const getJobInfo = (params) => {
  return service({
    url: 'release/getJobInfo',
    method: 'get',
    params
  })
}

export const findRelease = (params) => {
  return service({
    url: 'release/findRelease',
    method: 'get',
    params
  })
}

export const getPipeline = (params) => {
  return service({
    url: 'release/getPipeline',
    method: 'get',
    params
  })
}

export const restartDeployment = (data) => {
  return service({
    url: 'k8s/restartDeployment',
    method: 'post',
    data
  })
}

export const setReplicate = (data) => {
  return service({
    url: 'k8s/setReplicate',
    method: 'post',
    data
  })
}

export const cancelPipeline = (data) => {
  return service({
    url: 'release/cancelPipeline',
    method: 'post',
    data
  })
}

export const retryPipeline = (data) => {
  return service({
    url: 'release/retryPipeline',
    method: 'post',
    data
  })
}

export const findFlow = (params) => {
  return service({
    url: 'iteration/findFlow',
    method: 'get',
    params
  })
}

export const findFlowByIerationId = (params) => {
  return service({
    url: 'iteration/findFlowByIerationId',
    method: 'get',
    params
  })
}

export const updateFlowStatus = (data) => {
  return service({
    url: 'iteration/updateFlowStatus',
    method: 'put',
    data
  })
}

export const getBeforeTestInfo = (params) => {
  return service({
    url: 'iteration/getBeforeTestInfo',
    method: 'get',
    params
  })
}

export const executeFlow = (data) => {
  return service({
    url: 'iteration/executeFlow',
    method: 'post',
    data
  })
}

export const batchCreateTag = (data) => {
  return service({
    url: 'app/batchCreateTag',
    method: 'post',
    data
  })
}
